# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=mprocs
pkgver=0.6.4
pkgrel=1
pkgdesc="Run multiple commands in parallel"
url="https://github.com/pvolok/mprocs"
# s390x, riscv64: blocked by rust/cargo
# loongarch64: build failed caused by nix
arch="aarch64 armhf armv7 ppc64le x86 x86_64"
license="MIT"
makedepends="cargo lua5.4-dev cargo-auditable"
source="https://github.com/pvolok/mprocs/archive/v$pkgver/mprocs-$pkgver.tar.gz
	fix-portable_pty-tests.patch
	unbundle-lua.patch
	"
options="net" # fetch dependencies

export CARGO_PROFILE_RELEASE_OPT_LEVEL="z"

prepare() {
	default_prepare

	# tests for a vendored fork of a crate
	# https://github.com/pvolok/mprocs/issues/50
	rm vendor/vt100/tests/*.rs

	cargo fetch --target="$CTARGET" --locked
}

build() {
	cargo auditable build --frozen --release
}

check() {
	cargo test --frozen
}

package() {
	install -D -m755 target/release/mprocs -t "$pkgdir"/usr/bin/
}

sha512sums="
7fdade0d8cf09a9a4f71c4f46072c7e1fb96e919577d813600a9461bf2c1e3e4d881fb8265037f08f49c594d652620f6f68b3b3ed084a23d66821f3d7e40edbf  mprocs-0.6.4.tar.gz
605a54a8feea340fcd89ba7c976749719844e160be7446948bf94ba894c0532aa240ed060b38a1202d4fa7638e7576dd7356d16be8e9cfc3ae4ec0f622d43f92  fix-portable_pty-tests.patch
cad7615e9b927c46faf7996e40d8b8efee8a596078be5997d13bcf4c1e9505d157662473bc6b6206a73276018d1fd531f361968c4575bc65a6035fcdfbbfdb2c  unbundle-lua.patch
"
